import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-03-11
 * Time: 18:51
 */
public class parctice {
    //字符串与整型之间的转换
    public static void main(String[] args) {
        int num=10;
        String str1 = num+"";
        System.out.println(str1);
    }
    //猜数字游戏
    public static void main7(String[] args) {
        Scanner scan = new Scanner(System.in);
        Random random = new Random();            //生成随机数
        int rand = random.nextInt(50)+50; //范围[0,50) +50 ->[50,100)
        System.out.println(rand);
        while(true)
        {
            int num = scan.nextInt();
            if(num > rand) {
                System.out.println("猜大了");
            } else if( num < rand) {
                System.out.println("猜小了");
            } else {
                System.out.println( "猜中了！");
                break;
            }
        }
    }
    //输入复习
    public static void main6(String[] args) {
        Scanner scan = new Scanner(System.in);
        int i=0;
        while( scan.hasNextInt()){
             i= scan.nextInt();
            System.out.println(i);
        }
    }

    //同时求1-100奇数的和，和偶数的和
    public static void main5(String[] args) {
        int i=1,s1=0,s2=0;
        for(;i<=100;i++){
            if(i % 2 == 0) {
                s2=s2+i;
            } else {
                s1=s1+i;
            }
        }
        System.out.println("奇数的和 = "+s1);
        System.out.println("偶数的和 = "+s2);
    }
    //找到1-100之间既能被3整除又能被5整除的数
    public static void main4(String[] args) {
        int i=1;
        while(i<=100){
            if(i%3!=0||i%5!=0){
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }
    //计算 1-5的阶乘和
    public static void main3(String[] args) {
        int i=1,s=1,sum=0;
        while(i<=5){
            s=s*i;
            sum=sum+s;
            i++;
        }
        System.out.println(sum);
    }
    //计算5的阶乘
    public static void main2(String[] args) {
        int i=1,s=1;
        while(i<=5){
            s=s*i;
            i++;
        }
        System.out.println(s);
    }
    //计算1-100的和
    public static void main1(String[] args) {
        int i=1,sum=0;
        while(i<=100){
            sum=sum+i;
            i++;
        }
        System.out.println(sum);

    }
}
